package cn.hbu.zlfw.dic.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.NotBlank;


/**
 * 
 * @ClassName: DicSubject 
 * @Description: 学科字典表实体类
 * @author 王鹏伟<1223443289@qq.com>
 * @date 2017年11月7日 下午9:44:02  
 * @version V1.0
 */
@Entity
@Table(name="t_dic_subject")
public class DicSubject implements Serializable{
	private static final long serialVersionUID = 9180560374359838670L;

	@Id
	@Column(name="id",length=32)
	@GeneratedValue(generator="UUID_KEY")
	@GenericGenerator(name="UUID_KEY",strategy="uuid.hex")
	private String id;
	
	@NotNull(message = "{NotNull.subject.typeCode}")
	@Column(name="typeCode",length=20,nullable=false)
	private Integer typeCode;
	
	@NotBlank(message = "{NotBlank.subject.description}")
	@Column(name="description",length=80,nullable=false)
	private String description;
	
	@Column(name="remarks")
	private String remarks;		//备注
	
	@Column(name="delState",length=20,nullable=false)
	private Integer delState;	//删除状态,1表示已经删除，0表示未删除
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="createTime",nullable=false)
	private Date createTime;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="updateTime",nullable=false)
	private Date updateTime;
	
	@OneToMany 
	@JoinColumn(name = "dicSubject_id")// 必须写，否则会生成一个连接表  
	@Cascade({CascadeType.ALL}) 
	private Set<DicPrimarySubject> dicPrimarySubjectp;
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Integer getTypeCode() {
		return typeCode;
	}

	public void setTypeCode(Integer typeCode) {
		this.typeCode = typeCode;
	}
	
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public Integer getDelState() {
		return delState;
	}

	public void setDelState(Integer delState) {
		this.delState = delState;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	public Set<DicPrimarySubject> getDicPrimarySubjectp() {
		return dicPrimarySubjectp;
	}

	public void setDicPrimarySubjectp(Set<DicPrimarySubject> dicPrimarySubjectp) {
		this.dicPrimarySubjectp = dicPrimarySubjectp;
	}

	@Override
	public String toString() {
		return "DicPatentApplyField [id=" + id + ", typeCode=" + typeCode + ", description=" + description
				+ ", remarks=" + remarks + ", delState=" + delState + ", createTime=" + createTime + ", updateTime="
				+ updateTime + "]";
	}
}
